<%@page contentType="text/html" pageEncoding="UTF-8" import="consultas.funciones"%>
<jsp:useBean id="reg" class="consultas.funciones" scope="session" />
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>www.queterifas.com</title>
        
        <script type="text/javascript">
            /*FUNCIONES CON ARRAY PARA LOS DIAS, MESES Y AÑOS DE LA FECHA EN EL FORM*/
	function dias(){
		var dias=31;
		document.write("<option>Día</option>")
		for(i=1;i<=dias;i++){
			if(i<10)
			document.write("<option>"+"0"+i+"</option>");
			else
			document.write("<option>"+i+"</option>");
			}
		};
		
	function meses(){
		var meses=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];
		document.write("<option>Mes</option>");
		for(i=0;i<meses.length;i++){
				document.write("<option>"+meses[i]+"</option>");
			}
		};
		
	function ainos(){
		var aino=1940;
		document.write("<option>Año</option>");
		for(i=new Date().getFullYear();i>=aino;i--){
			document.write("<option>"+i+"</option>");
			}
		};
                
                /* FUNCIONES PARA LAS PROVINCIAS Y POBLACIONES */
        function provincia(){
            var provincias=["GIPUZKOA","BIZKAIA","ALAVA"];
            document.write("<option value='"+0+"'>PROVINCIA</option>");
		for(i=0;i<provincias.length;i++){
				document.write("<option value='"+(i+1)+"'>"+provincias[i]+"</option>");
			}
        };
        
        function poblaciones(value){
            var gipuzkoa=["Abaltzisketa","Aduna","Aia","Aizarnazabal","Albiztur","Alegia","Alkiza","Altzaga","Altzo","Amezketa","Andoain","Anoeta","Antzuola","Arama","Aretxabaleta","Arrasate/Mondragón","Asteasu","Astigarraga","Ataun","Azkoitia","Azpeitia","Baliarrain","Beasain","Beizama","Belauntza","Berastegi","Bergara","Berrobi","Bidegoian","Deba","Donostia-San Sebastián","Eibar","Elduain","Elgeta","Elgoibar","Errenteria","Errezil","Eskoriatza","Ezkio-Itsaso","Gabiria","Gaintza","Gaztelu","Getaria","Hernani","Hernialde","Hondarribia","Ibarra","Idiazabal","Ikaztegieta","Irun","Irura","Itsasondo","Larraul","Lasarte-Oria","Lazkao","Leaburu","Legazpi","Legorreta","Leintz-Gatzaga","Lezo","Lizartza","Mendaro","Mutiloa","Mutriku","Oiartzun","Olaberria","Oñati","Ordizia","Orendain","Orexa","Orio","Ormaiztegi","Pasaia","Segura","Soraluze/Placencia de las Armas","Tolosa","Urnieta","Urretxu","Usurbil","Villabona","Zaldibia","Zarautz","Zegama","Zerain","Zestoa","Zizurkil","Zumaia","Zumarraga"];
            var pro = document.getElementById('provincia');
            if(pro.value == "0"){
                document.form_registro.poblacion.disabled=true;
                document.write("<option>POBLACIÓN</option>");
            }else{
            if(pro.value == "1"){
                document.form_registro.poblacion.disabled=false;
                //document.getElementById("poblacion")
                document.write("<option>Población</option>");
		for(i=0;i<gipuzkoa.length;i++){
				document.write("<option>"+gipuzkoa[i]+"</option>");
			}
            }
            }
        };
        </script>
    </head>
    <body>
        <!-- INCLUDE PARA METER EL HEADER -->
        <jsp:include page="includes/header.jsp"/>
            <section id="contenedor">
                <form id="form_registro" name="form_registro" method="POST" action="control.jsp">
                    <input type="text" placeholder="Nombre de Usuario" required/><br>
                    <input type="password" placeholder="Contraseña" required/><br>
                    <input type="password" placeholder="Vuelva a escribir la contraseña" required/><br>
                    <input type="text" placeholder="Correo Electronico" required/><br>
                    <input type="text" placeholder="Carnet de Identificación" required/><br>
                    <input type="text" placeholder="Nombre Completo" required/><br>
                    <input type="text" placeholder="Apellidos" required/><br>
                    
                    <!-- PETICIÓN DE FECHA DE NACIMIENTO -->
                    <label>Fecha de nacimiento</label><br>
                        <select id="dias" name="dia" required>
                                <script>
                                dias();
                                </script>
                        </select>

                        <select id="meses" name="mes" required>
                                <script>
                                meses();
                                </script>
                        </select>

                        <select id="ainos" name="aino" required>
                                <script>
                                ainos();
                                </script>
                        </select><br>
                    <!-- FIN DE PETICIÓN DE FECHA DE NACIMIENTO -->
                    
                    <input type="text" placeholder="Dirección" required /><br>
                    
                    <!-- PETICIÓN DE PROVINCIA Y POBLACIÓN -->
                    
                    <select id="provincia" name="provincia" onchange="poblaciones();" required>
                                <script>
                                provincia();
                                </script>
                    </select>
                    
                    <select id="poblacion" name="poblacion" required>
                                <script>
                                poblaciones();
                                </script>
                    </select>
                    
                </form>
            </section>
        <!-- INCLUDE PARA METER EL FOOTER -->
        <%@
            include file="includes/footer.jsp"
        %>
    </body>
</html>
